﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ADH.Common;

namespace ADH.DevHelperWeb.Controllers
{
    public class EncController : Controller
    {
        // GET: Enc
        public ActionResult Index()
        {
            return View();
        }

        [HttpPost]
        public ActionResult Index(string s,string t)
        {
            if(string.IsNullOrWhiteSpace(s))
            {
                return Json("请输入要加密或解密的内容");
            }

            if(t == "e")//加密
            {
                return Json(new DEncryptHelp().EncryptString(s));
            }
            else if( t == "d")//解密
            {
                return Json(new DEncryptHelp().DecryptString(s));
            }
            else
            {
                return Json("请选择类型");
            }
            
        }
    }
}